package com.zhl.spark.core.simple

import java.io.ObjectInputStream
import java.net.ServerSocket

/**
 * @program: demos
 * @description: ${description}
 * @author: 刘振华
 * @create: 2020-11-30 16:23
 **/
object SimpleExecutor {

    //为服务器类，接收数据并且计算
    def main(args: Array[String]): Unit = {
        val server = new ServerSocket(19999)

        val in = server.accept().getInputStream()

        val objIn = new ObjectInputStream(in)

        val task = objIn.readObject().asInstanceOf[SimpleTask]

        task.compute().map(println)

        objIn.close()

        server.close()
    }
}
